package com.xuecheng.system.convert;

import com.xuecheng.api.system.model.CourseCategoryDTO;
import com.xuecheng.system.entity.ex.CourseCategoryNode;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface CourseCategoryConvert {
    CourseCategoryConvert INSTANCE = Mappers.getMapper(CourseCategoryConvert.class);
    /**
     * CourseCategoryNode转化成CourseCategoryDTO
     */
    @Mappings({@Mapping(source = "id",target = "courseCategoryId"),@Mapping(source = "childrenTreeNodes",target = "categoryTreeNodes")})
    CourseCategoryDTO CourseCategoryNodeToDTO(CourseCategoryNode courseCategoryNode);

    /**
     * CourseCategoryNode集合转化成CourseCategoryDTO集合
     */
    List<CourseCategoryDTO> CourseCategoryNodeListToDTOList(List<CourseCategoryNode> courseCategoryNodes);
}
